package tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



import warehouse.Mouse;


/**
 *Item class tests
 *@author Apeiranthitis, Grassos, Moschos
 */
public class ItemTest {

	public ItemTest() {
	}

	@BeforeClass
	public static void setUpClass() throws Exception {
	}

	@AfterClass
	public static void tearDownClass() throws Exception {
	}

	@Before
	public void setUp() {
	}

	@After
	public void tearDown() {
	}

	/**
	 * Test of init method, of class Item.
	 */
	@Test
	public void testInitCorrect() {
		System.out.println("init");
		Mouse instance = new Mouse("101", "10", "190", "wireless", 3, "grey");
		instance.init();
		assertTrue(!instance.getItemID().equals("Wrong"));
	}
	@Test
	public void testInitEmptyItemId() {
		System.out.println("init2");
		Mouse instance = new Mouse(" ", "10", "190", "wireless", 3, "grey");
		instance.init();
		assertTrue(instance.getItemID().equals("Wrong"));
	}
	@Test
	public void testInitNegativeItemId() {
		System.out.println("init3");
		Mouse instance = new Mouse("-100", "10", "190", "wireless", 3, "grey");
		instance.init();
		assertTrue(instance.getItemID().equals("Wrong"));
	}
	@Test
	public void testInitNegativePrice() {
		System.out.println("init4");
		Mouse instance = new Mouse("101", "-10", "190", "wireless", 3, "grey");
		instance.init();
		assertTrue(instance.getItemID().equals("Wrong"));
	}
	@Test
	public void testInitArithmeticType() {
		System.out.println("init5");
		Mouse instance = new Mouse("101", "-10", "190", "2", 3, "grey");
		instance.init();
		assertTrue(instance.getItemID().equals("Wrong"));
	}

	@Test
	public void testInitNegativeQuantity() {
		System.out.println("init6");
		Mouse instance = new Mouse("101", "10", "-190", "wireless", 3, "grey");
		instance.init();
		assertTrue(instance.getItemID().equals("Wrong"));
	}

	/**
	 * Test of equals method, of class Item.
	 */
	@Test
	public void testEquals() {
		System.out.println("equals");
		Object other = new Mouse("101", "grey", "wireless", "3", 10, "190");
		Mouse instance = new Mouse("101", "red", "wireless", "4", 20, "100");
		boolean expResult = true;
		boolean result = instance.equals(other);
		assertEquals(expResult, result);
	}
}
